﻿<UserControl x:Class="Coolvis.Console.Theme.MainViewControl.SelectSceneView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" d:DesignWidth="600" d:DesignHeight="400">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Coolvis.Console.Theme;component/Resources/Green.xaml"/>
                <ResourceDictionary>
                    <ImageBrush x:Key="selected" ImageSource="../Images/ziding1.png" />
                    <ImageBrush x:Key="normal" ImageSource="../Images/ziding2.png" />
                    <ImageBrush x:Key="showing" ImageSource="../Images/ziding4.png" />
                    <ImageBrush x:Key="showingSub" ImageSource="../Images/120fang.png" />
                    <ImageBrush x:Key="loading" ImageSource="../Images/Loading.png" />
                    <ImageBrush x:Key="loadingSub" ImageSource="../Images/LoadingSub.png" />
                    <ImageBrush x:Key="BrushMainSceneNormal" ImageSource="../Resources/Images/BtnMainSceneNormal.jpg" />
                    <ImageBrush x:Key="BrushMainSceneActive" ImageSource="../Resources/Images/BtnMainSceneActive.jpg" />
                    <Style x:Key="btnLabel" TargetType="{x:Type Button}">
                        <Setter Property="Foreground" Value="White"/>
                        <Setter Property="FontSize" Value="20"/>
                        <Setter Property="FontFamily" Value="微软雅黑"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                        <Setter Property="TextBlock.TextWrapping" Value="Wrap"/>
                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                        <Setter Property="VerticalContentAlignment" Value="Center" />
                        <Setter Property="Cursor" Value="Hand" />
                        <Setter Property="Background" Value="{StaticResource normal}" />
                        <Setter Property="Template">
                            <Setter.Value>
                                <!--控件模板-->
                                <ControlTemplate TargetType="Button">
                                    <!--背景色-->
                                    <Border x:Name="back" CornerRadius="3">
                                        <Border.Background>
                                            <ImageBrush ImageSource="{Binding RelativeSource={RelativeSource TemplatedParent},Path=(Button.Background).(ImageBrush.ImageSource)}" Stretch="Fill"/>
                                        </Border.Background>
                                        <!--前景色及边框-->
                                        <Border x:Name="fore" BorderThickness="0" CornerRadius="3" BorderBrush="#5555">
                                            <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center">
                                                <ContentPresenter.Content>
                                                    <TextBlock TextWrapping="Wrap" Text="{TemplateBinding  Content}" MaxWidth="100" TextAlignment="Center" ></TextBlock>
                                                </ContentPresenter.Content>
                                            </ContentPresenter>
                                        </Border>
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsPressed" Value="true">
                                            <Setter Property="Background" TargetName="back" Value="{StaticResource selected}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <!--定义按钮样式-->
                    <Style x:Key="btnDisplayflow" TargetType="{x:Type Button}">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type Button}">
                                    <Border x:Name="border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
                                        <ContentPresenter x:Name="contentPresenter" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    </Border>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>


                    <Style TargetType="{x:Type ToggleButton}" x:Key="BtnMainScene">
                        <Setter Property="Foreground" Value="#FEFEFE"/>
                        <Setter Property="Width" Value="240"/>
                        <Setter Property="Height" Value="160"/>
                        <Setter Property="HorizontalContentAlignment" Value="Center"/>
                        <Setter Property="VerticalContentAlignment" Value="Center"/>
                        <Setter Property="FontSize" Value="24"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type ToggleButton}">
                                    <Border BorderThickness="0" CornerRadius="1"
    							HorizontalAlignment="{TemplateBinding HorizontalAlignment}"   
    							VerticalAlignment="{TemplateBinding VerticalAlignment}"
                                Background="{StaticResource BrushMainSceneNormal}"
                            x:Name="_border">
                                        <ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                    </Border>
                                    <ControlTemplate.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                        </Trigger>
                                        <Trigger Property="IsKeyboardFocused" Value="true"/>
                                        <Trigger Property="ToggleButton.IsChecked" Value="true">
                                            <Trigger.EnterActions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="_border" Storyboard.TargetProperty="(Border.Background)">
                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BrushMainSceneActive}" />
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </Trigger.EnterActions>
                                            <Trigger.ExitActions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="_border" Storyboard.TargetProperty="(Border.Background)">
                                                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BrushMainSceneNormal}" />
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </Trigger.ExitActions>
                                        </Trigger>
                                        <Trigger Property="IsEnabled" Value="false">
                                            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                    <Style x:Key="NoneBorderButton" TargetType="Button">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Button">
                                    <ContentPresenter Content="{TemplateBinding Content}"/>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="20,0,20,0">
        <Grid Height="160" VerticalAlignment="Center">
            <Grid Name="SubGrid" Visibility="Collapsed" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="0.05*"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="0.05*"/>
                </Grid.ColumnDefinitions>

                <DockPanel Grid.Column="0" >
                    <Button x:Name="leftSubLoop" Style="{StaticResource btnDisplayflow}" BorderThickness="0" 
                    Grid.Row="0" Grid.Column="0" HorizontalAlignment="Right" VerticalAlignment="Center"  Width="50" 
                    Height="130" Panel.ZIndex="2" Cursor="Hand" Click="leftSubLoop_Click" PreviewMouseLeftButtonDown="leftSubLoop_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="leftSubLoop_PreviewMouseLeftButtonUp" TouchDown="leftSubLoop_TouchDown" TouchUp="leftSubLoop_TouchUp" MouseEnter="leftSubLoop_MouseEnter"  MouseLeave="leftSubLoop_MouseLeave"  TouchEnter="leftSubLoop_TouchEnter" TouchLeave="leftSubLoop_TouchLeave"  Opacity="0.2" >
                        <Button.Background>
                            <ImageBrush ImageSource="../Images/左侧激活.png"/>
                        </Button.Background>
                    </Button>

                </DockPanel>
                <ScrollViewer x:Name="_subScrollViewer" Grid.Column="1" Padding="40,20,40,10"  HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch" >
                    <ScrollViewer.Background>
                        <ImageBrush ImageSource="../Images/bg4.png" Stretch="Fill"></ImageBrush>
                    </ScrollViewer.Background>
                    <StackPanel x:Name="SubScenePanel" MinHeight="140" MaxHeight="140"   VerticalAlignment="Center" Orientation="Horizontal">
                    </StackPanel>
                </ScrollViewer>

                <DockPanel Grid.Column="2" >
                    <Button x:Name="rightSubLoop" Style="{StaticResource btnDisplayflow}" BorderThickness="0" 
                    Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Center"  Width="50" 
                    Height="130" Panel.ZIndex="2" Cursor="Hand"  Click="rightSubLoop_Click" PreviewMouseLeftButtonDown="rightSubLoop_PreviewMouseLeftButtonDown" PreviewMouseLeftButtonUp="rightSubLoop_PreviewMouseLeftButtonUp" TouchDown="rightSubLoop_TouchDown" TouchUp="rightSubLoop_TouchUp" MouseEnter="rightSubLoop_MouseEnter"  MouseLeave="rightSubLoop_MouseLeave"  TouchEnter="rightSubLoop_TouchEnter" TouchLeave="rightSubLoop_TouchLeave"  Opacity="0.2" >
                        <Button.Background>
                            <ImageBrush ImageSource="../Images/右侧激活.png" />
                        </Button.Background>
                    </Button>
                </DockPanel>
            </Grid>
            <Grid x:Name="gridSelectSceneView">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <Button x:Name="btnScrollLeft" Style="{StaticResource BtnIcon}" Grid.Row="0" Grid.Column="0" Margin="5" VerticalAlignment="Center" Click="OnBtnScrollLeftClick">
                    <Grid>
                        <Ellipse Fill="#55000000" Width="64" Height="64">
                        </Ellipse>
                        <TextBlock Text="&#xf137;" FontSize="32" Style="{StaticResource FontAwesome}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                    </Grid>
                </Button>
                <Grid Grid.Column="1" >
                    <ScrollViewer x:Name="ctlMainSceneScroller" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch" >
                        <StackPanel x:Name="ctlMainSceneContainer" Orientation="Horizontal">
                        </StackPanel>
                    </ScrollViewer>
                </Grid>
                <Button x:Name="btnScrollRight" Style="{StaticResource BtnIcon}" Grid.Row="0" Grid.Column="2" Margin="5" VerticalAlignment="Center" Click="OnBtnScrollRightClick">
                    <Grid>
                        <Ellipse Fill="#55000000" Width="64" Height="64">
                        </Ellipse>
                        <TextBlock Text="&#xf138;" FontSize="32" Style="{StaticResource FontAwesome}" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0"/>
                    </Grid>
                </Button>
            </Grid>
        </Grid>
    </Grid>
</UserControl>
